﻿using System;
using uTILLIty.Rave.Contract.Configuration;

namespace uTILLIty.Rave.Contract.Exception
{
	/// <summary>
	/// An instance is raised by the ConfigurationValidator (see Core library) to inform
	/// of any (usually all) errors occured during validation-phase of the supplied <see cref="Configuration"/>
	/// </summary>
	public class ConfigurationErrorException : ApplicationException
	{
		/// <summary>
		/// Creates a new instance of the <see cref="ConfigurationErrorException"/>
		/// </summary>
		/// <param name="innerException">the inner exception which caused this error</param>
		/// <param name="message">a detailed message explaining the problem</param>
		/// <param name="args">optional arguments of the <paramref name="message"/></param>
		public ConfigurationErrorException(System.Exception innerException, string message, params object[] args)
			: base(string.Format(message, args ?? new object[0]), innerException)
		{
		}

		/// <summary>
		/// Creates a new instance of the <see cref="ConfigurationErrorException"/>
		/// </summary>
		/// <param name="message">a detailed message explaining the problem</param>
		/// <param name="args">optional arguments of the <paramref name="message"/></param>
		public ConfigurationErrorException(string message, params object[] args) 
			: base(string.Format(message, args ?? new object[0]))
		{
		}
	}
}